package cn.gzjp.modules.logis.entity;

import cn.hutool.core.util.StrUtil;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

/**
 * 物流用户Entity
 * @author zengcp
 * @version 2018-03-21
 */
public class LogisUser extends DataEntity<LogisUser> {
	
	private static final long serialVersionUID = 1L;
	private String headImg;		// 头像
	private String nickName;		// 昵称
	private String realName;
	private String mobile;		// 手机号
	private String type;		// 1工厂与货主 2司机 3专线合伙人
	private String role;		// A工厂B货主C司机
	private Date registTime;		// 注册时间
	private BigDecimal balance;//账户当前余额（可能是提现后剩余的）
	private BigDecimal incomeTotal;//收入总额(司机的获得的运费累积总额，工厂获得的奖励金总额，合伙人获得的佣金总额)
	private BigDecimal commissionTotal;//佣金（车主给合伙人累积挣得的钱）
	private int commissionRate;//合伙人佣金比例
	private int scoreTotal;//用户总积分
	private int creditTotal;//用户信用分
	private int authStatus;//0未认证 1已认证
	private String carInfo;//车辆信息
	private int jiaocheNum;//叫车下单次数
	private int chengjiaoNum;//成交单数
	private int shouhuoNum;//收货次数
	private int jiedanNum;//司机接单次数
	private int friendNum;//好友数量
	private Integer status;//状态  0默认用户，地区限制,1白名单
	private String shareOpenid;//分享者,推荐者

	private boolean receivePmsg;//是否接收推送消息
	private String licensePlate;		// 司机车牌

	private String appId;
	private String unionId;

	private int fleetNum;//车队数量
	private String parentName;//上级昵称;

	private Integer carStatus;		// 车辆审核状态 -1 未提交认证 0审核中 1已认证 2请重新上传
	private Integer driverStatus;		//司机审核状态 -1未提交认证 0审核中 1已认证 2请重新上传
	private Integer roadCount;//司机绑定车辆数量,0表示没有
	private LogisCarRoad firstRoad;//司机的第一条线路信息


	private BigDecimal gainReward;//获得的奖励金

	public BigDecimal getBalance() {
		return balance;
	}

	public void setBalance(BigDecimal balance) {
		this.balance = balance;
	}

	public int getScoreTotal() {
		return scoreTotal;
	}

	public void setScoreTotal(int scoreTotal) {
		this.scoreTotal = scoreTotal;
	}

	public LogisUser() {
		super();
	}

	public LogisUser(String id){
		super(id);
	}

	@Length(min=0, max=256, message="头像长度必须介于 0 和 256 之间")
	@ExcelField(title="头像", align=2, sort=1)
	public String getHeadImg() {
		return headImg;
	}

	public void setHeadImg(String headImg) {
		this.headImg = headImg;
	}
	
	@Length(min=0, max=32, message="昵称长度必须介于 0 和 32 之间")
	@ExcelField(title="昵称", align=2, sort=2)
	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	
	@Length(min=0, max=12, message="手机号长度必须介于 0 和 12 之间")
	@ExcelField(title="手机号", align=2, sort=3)
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	@Length(min=0, max=1, message="1货主 2车主长度必须介于 0 和 1 之间")
	@ExcelField(title="1货主 2车主", align=2, sort=4)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	@Length(min=0, max=1, message="A工厂B货主C主司机D副驾驶长度必须介于 0 和 1 之间")
	@ExcelField(title="A工厂B货主C主司机D副驾驶", align=2, sort=5)
	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="注册时间", align=2, sort=6)
	public Date getRegistTime() {
		return registTime;
	}

	public void setRegistTime(Date registTime) {
		this.registTime = registTime;
	}

	public int getAuthStatus() {
		return authStatus;
	}

	public void setAuthStatus(int authStatus) {
		this.authStatus = authStatus;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getCarInfo() {
		return carInfo;
	}

	public void setCarInfo(String carInfo) {
		this.carInfo = carInfo;
	}

	public int getJiaocheNum() {
		return jiaocheNum;
	}

	public void setJiaocheNum(int jiaocheNum) {
		this.jiaocheNum = jiaocheNum;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getShareOpenid() {
		return shareOpenid;
	}

	public void setShareOpenid(String shareOpenid) {
		this.shareOpenid = shareOpenid;
	}

	public int getFriendNum() {
		return friendNum;
	}

	public void setFriendNum(int friendNum) {
		this.friendNum = friendNum;
	}

	public int getShouhuoNum() {
		return shouhuoNum;
	}

	public void setShouhuoNum(int shouhuoNum) {
		this.shouhuoNum = shouhuoNum;
	}

	public int getJiedanNum() {
		return jiedanNum;
	}

	public void setJiedanNum(int jiedanNum) {
		this.jiedanNum = jiedanNum;
	}

	public int getCreditTotal() {
		return creditTotal;
	}

	public void setCreditTotal(int creditTotal) {
		this.creditTotal = creditTotal;
	}

	public boolean isReceivePmsg() {
		return receivePmsg;
	}

	public void setReceivePmsg(boolean receivePmsg) {
		this.receivePmsg = receivePmsg;
	}

	public BigDecimal getIncomeTotal() {
		return incomeTotal;
	}

	public void setIncomeTotal(BigDecimal incomeTotal) {
		this.incomeTotal = incomeTotal;
	}

	public BigDecimal getCommissionTotal() {
		return commissionTotal;
	}

	public void setCommissionTotal(BigDecimal commissionTotal) {
		this.commissionTotal = commissionTotal;
	}

	public String getLicensePlate() {
		return licensePlate;
	}

	public void setLicensePlate(String licensePlate) {
		this.licensePlate = licensePlate;
	}

	public int getCommissionRate() {
		return commissionRate;
	}

	public void setCommissionRate(int commissionRate) {
		this.commissionRate = commissionRate;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getUnionId() {
		return unionId;
	}

	public void setUnionId(String unionId) {
		this.unionId = unionId;
	}

	public int getFleetNum() {
		return fleetNum;
	}

	public void setFleetNum(int fleetNum) {
		this.fleetNum = fleetNum;
	}

	public Integer getCarStatus() {
		return carStatus;
	}

	public void setCarStatus(Integer carStatus) {
		this.carStatus = carStatus;
	}

	public Integer getDriverStatus() {
		return driverStatus;
	}

	public void setDriverStatus(Integer driverStatus) {
		this.driverStatus = driverStatus;
	}

	public Integer getRoadCount() {
		return roadCount;
	}

	public void setRoadCount(Integer roadCount) {
		this.roadCount = roadCount;
	}

	public LogisCarRoad getFirstRoad() {
		return firstRoad;
	}

	public void setFirstRoad(LogisCarRoad firstRoad) {
		this.firstRoad = firstRoad;
	}

	public String getParentName() {
		if(StrUtil.isBlank(parentName)){
			parentName="系统";
		}
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public int getChengjiaoNum() {
		return chengjiaoNum;
	}

	public void setChengjiaoNum(int chengjiaoNum) {
		this.chengjiaoNum = chengjiaoNum;
	}

	public BigDecimal getGainReward() {
		return gainReward;
	}

	public void setGainReward(BigDecimal gainReward) {
		this.gainReward = gainReward;
	}
}